﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Backend/Backend.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<IntroduceCompany.AdminListView>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	AdminList
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<!-- Begin one column tab content window -->
    <div class="onecolumn">
        <div class="header">
            <span>Danh Sách Admin</span>
            <div class="switchbutton">
                <a href="<%= Url.Action("AdminCreate", "Admin") %>" class="button">Thêm mới</a>
            </div>
        </div>
        <br class="clear" />
        <div class="content">
            <div id="tab1_content" class="tab_content">
                <table width="100%">
                    <tr>
                        <td>
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" style="width:170px;" />
                                    </div>
                                    <div class="details">
                                        <div>
                                            Kết quả
                                            <span id="startrecord"></span>-<span id="endrecord"></span>
                                            của
                                            <span id="totalrecords"></span>
                                        </div>
                                        <div><a href="javascript:sorter.reset()">Thiết lập lại</a></div>
                                    </div>
                                    <%--<div>
                                        <% using (Html.BeginForm("ChangeProductType", "Product", FormMethod.Post, new { id = "TheForm2" })){ %>
                                                <%= Html.DropDownList("productTypeID", (SelectList)ViewData["ProductTypeList"], new { onchange = "this.form.submit();" })%>
                                            <% } %>
                                    </div>--%>
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                        <tr>
                                           <th><h3>Họ và tên</h3></th>
                                           <th><h3>Tên đăng nhập</h3></th>
                                            <th><h3>Email</h3></th>
                                            <th><h3>Điện thoại</h3></th>
                                            <th><h3>Quyền truy cập</h3></th>
                                            <th><h3>Tình trạng</h3></th>
                                            <th class="nosort"><h3>Ẩn/Hiện</h3></th>
                                            <th class="nosort"><h3>Sửa</h3></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% foreach (var item in Model  ) { %>
                                        <tr>
                                            <td style="width: 170px; text-align: center;">
                                                <%= item.FullName%>
                                            </td>
                                            <td style="width: 150px; text-align: center;">
                                                 <%= Html.Encode(item.UserName)%>
                                            </td>
                                            <td>
                                                <%= Html.Encode(item.Email)%>
                                            </td>
                                            <td style="width:80px;">
                                                <%= Html.Encode(item.Phone)%>
                                            </td>
                                            <td>
                                                <%= Html.Encode(item.RoleName)%>
                                            </td>
                                            <td style="width: 80px;text-align: center">
                                            <%if (item.AdminState < 0)
                                              { %>
                                                <img src="../../../Content/Backend/js/table/images/icon-user-on.png" alt="" title="Đang truy cập" />
                                                <%}
                                              else
                                              { %>
                                                <img src="../../../Content/Backend/js/table/images/icon-user-off.png" alt="" title="Đã thoát" /><%} %>
                                            </td>
                                            <td style="width: 50px;text-align: center">
                                                <%if (item.Visible)
                                                  {%>
                                                    <a href="<%= Url.Action("ChangeAdminVisible","Admin", new { adminID = item.AdminID, visible = item.Visible }) %>">
                                                        <img src="../../../Content/Backend/js/table/images/activation.png" alt=""/></a>
                                                <%}
                                                  else
                                                  {%>
                                                    <a href="<%= Url.Action("ChangeAdminVisible","Admin", new { adminID = item.AdminID, visible = item.Visible }) %>">
                                                        <img src="../../../Content/Backend/js/table/images/inactivation.png" alt=""/></a>
                                                <%} %>
                                            </td>
                                            <td style="width: 50px;text-align: center">
                                                <a href="<%= Url.Action("AdminEdit","Admin", new { adminID = item.AdminID }) %>">
                                                    <img src="../../../Content/Backend/js/table/images/grid_edit.png" alt=""/></a>
                                            </td>
                                        </tr>
                                        <% } %>
                                    </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img src="../../../Content/Backend/js/table/images/first.gif" alt="" />
                                            <img src="../../../Content/Backend/js/table/images/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />
                                            <img src="../../../Content/Backend/js/table/images/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />
                                            <img src="../../../Content/Backend/js/table/images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                                            <img src="../../../Content/Backend/js/table/images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown"></select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">Xem tất cả</a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="5">5</option>
                                                <option value="10" selected="selected">10</option>
                                                <option value="20">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                            </select>
                                            <span>Kết quả mỗi trang</span>
                                        </div>
                                        <div class="page">
                                            Trang
                                            <span id="currentpage"></span>
                                            của
                                            <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="../../../Content/Backend/js/table/2.js"></script>
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 10,
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    /*
                                    sortcolumn: 0,
                                    sortdir: 1,
                                    sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
<!-- End one column tab content window -->
</asp:Content>

